<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String Path = request.getContextPath();
	String basePath = request.getServerName() + ":" + request.getServerPort() + Path + "/";
%>
<script src="${pageContext.request.contextPath}/resources/js/sockjs-0.3.min.js"></script>

<script type="text/javascript">            
window.onload = function connect() {
	
	var path = '<%=basePath%>';
	
        if ('WebSocket' in window) {
            ws= new WebSocket("ws://" + path + "websck");
        }
        else if ('MozWebSocket' in window) {
            ws = new MozWebSocket("ws://"+ path +"websck");
        }
        else {
            ws = new SockJS("http://"+ path +"websck");
        }
        ws.onopen = function () {
          
        };
        ws.onmessage = function (event) {
          
       		var obj = eval('(' + event.data + ')');
       		
       		$("#msg1").html(obj.msg1);
       		$("#msg2").html(obj.msg2);
       		$("#msg3").html(obj.msg3);

        };
        ws.onclose = function (event) {

        };
    }
</script>
<div class=""  style="position: absolute; top: 0;">
			<img alt="" src="${pageContext.request.contextPath}/resources/images/Notice.gif" width="55px" height="53px" style=" top: 0; margin-right: 55px; float: left; margin-left: 20px;">
			<marquee style="margin: 0 !important; padding: 0; top:0; float:left; padding-left: 2em; margin-left: 55px;" direction="up" behavior="scroll" scrollamount="1" scrolldelay="0" loop="-1" width="700"  height="55px"  bgcolor="#FFF" >
				<p><font id="msg1" size="4" color="red"> </font></p>
				<p ><font id="msg2" size="4" color="red"> </font></p>
				<p ><font id="msg3" size="4" color="red"> </font></p>
			</marquee>
</div>

<!--body wrapper start-->
<div class="wrapper">
<div class="container-fluid">
	<h1>
		<label class="text-info">My 资料</label>
	</h1>
 
	<form class="form-horizontal"
		action="${pageContext.request.contextPath}/seller/user/updateSellerInfo"
		method="post" enctype="multipart/form-data" onsubmit = "return check();">
		<font size="3" color="green">${result}</font>

			<div class="form-group">
				<label for="img" class="col-sm-2 control-label">头像</label>
				<div class="col-md-3">
					<img src="${pageContext.request.contextPath}/resources/upload/user/${userinfo.username}${userinfo.img}"
			  width="80" height="80"  class="img-thumbnail"  >
			  <input type="file"  name="user_img" id="修改头像" > 
				</div>
				
			</div>

	    <!-- 帐号 -->
		<div class="form-group">
			<label for="username" class="col-sm-2 control-label">帐号</label>
			<div class="col-md-3">
				<input type="text" class="form-control" name="username" id="username"
					value="${userinfo.username}"  readonly="readonly">
			</div>
			<div class="col-md-3">
					<label  id="userLoginLabel"></label>
			</div>
		</div>
		
	    <!-- 余额 -->
		<div class="form-group">
			<label for="username" class="col-sm-2 control-label">余额</label>
			<div class="col-md-3">
				<input type="text" class="form-control" name="username" id="username"
					value="${sb_number}  （SB）"  readonly="readonly">
			</div>
			<div class="col-md-3">
					<a class="btn btn-warning" href="${pageContext.request.contextPath}/seller/user/toChongzhiPage">去充值</a>
			</div>
		</div>


		<div class="form-group">
			<label for="email" class="col-sm-2 control-label">邮箱</label>
			<div class="col-md-3">
				<input type="text" class="form-control" name="email" id="email"
					placeholder="${userinfo.email}" onpaste="return false" ondragenter="return false" oncontextmenu="return false;" style="ime-mode:disabled">
			</div>
			<div class="col-md-3">
					<label  id="emailLabel"></label>
			</div>
		</div>
		<div class="form-group">
			<label for="card" class="col-sm-2 control-label">card</label>
			<div class="col-md-3">
				<input type="text" class="form-control" name="card" id="card"
					placeholder="${userinfo.card}" onpaste="return false" ondragenter="return false" oncontextmenu="return false;" style="ime-mode:disabled">
			</div>
			<div class="col-md-3">
					<label  id="cardLabel"></label>
			</div>
		</div>
		<div class="row form-group">
			<div class="col-md-3 col-md-offset-2"> 
				<input type="submit" class="form-control btn btn-success" value="提交"  />
			</div>
			<div class="col-md-3">
				<input type="reset" class="form-control btn btn-success" value="重置" />
			</div>
		</div>
	</form>
</div>


<script type="text/javascript">
function check(){ /* passWord newpass */
	var txt_passWord = $.trim($("#email").attr("value")) ;
	var txt_newpass = $.trim($("#card").attr("value")) ;
	//var txt_newpass2 = $.trim($("#newpass2").attr("value")) ;

	$("#emailLabel").text("") 
	$("#cardLabel").text("") 

	var isSuccess = 1; 
	if(txt_email.length == 0||txt_email.length>15) 
	{ 
	$("#emailLabel").text("邮箱不符合要求！") 
	$("#emailLabel").css({"color":"red"}); 
	isSuccess = 0; 
	} 
	
	if(txt_email.length == 0) 
	{ 
	$("#emailLabel").text("邮箱不能为空！") 
	$("#emailLabel").css({"color":"red"}); 
	isSuccess = 0; 
	} 
	
	if(isSuccess == 0) 
	{ 
	return false; 
	}else{
	return true; 
	}
	} 
</script>

</div>

